<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>

        <ui:composition template="./templates/default.xhtml">

            <ui:define name="content">
                <link rel="stylesheet" type="text/css" href="resources/css/default.css"/>

                <h:form binding="#{messageManagerBean.loadMessagePage}">
                    <p:panel header="Reply Message" id="messagePanel">
                        <p:messages />
                        <table>
                            <tr>
                                <td>Recipient:</td>
                                <td><h:outputText id="receiver" value="#{messageManagerBean.senderId}" /></td>
                            </tr>
                            <tr>
                                <td>Subject:</td>
                                <td><h:outputText id="subject" value="Re: #{messageManagerBean.subject}" /></td>
                            </tr>
                            <tr>
                                <td>Content:</td>
                                <td>
                                    <p:editor value="#{messageManagerBean.content}" widgetVar="editor" width="600"
                                              required="true" requiredMessage="Content cannot be empty."/> 
                                </td>
                            </tr>
                            <tr>
                                <td></td>
                                <td><p:commandButton value="Reply" update="messagePanel" actionListener="#{messageManagerBean.replyMessage}" ajax="true"/> 
                                    <p:ajaxStatus style="width:16px;height:16px;">  
                                        <f:facet name="start">  
                                            <h:graphicImage value="resources/images/ajaxloading.gif" />  
                                        </f:facet>  

                                        <f:facet name="complete">  
                                            <h:outputText value="" />  
                                        </f:facet>  
                                    </p:ajaxStatus>
                                </td>
                            </tr>
                        </table>
                    </p:panel>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
